-
Notifications
You must be signed in to change notification settings - Fork 12.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use changeCompilerHostLikeToUseCache in synchronizeHostData #48980
Conversation
…g caching at that layer
src/services/services.ts
Outdated
cachingInEffect = false; | ||
compilerHost.getSourceFile = originalGetSourceFile; | ||
compilerHost.readFile = originalReadFile; | ||
compilerHost.fileExists = originalFileExists; | ||
compilerHost.directoryExists = originalDirectoryExists; | ||
compilerHost.createDirectory = originalCreateDirectory; | ||
compilerHost.writeFile = originalWriteFile!; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of having flag to see if caching is in effect, can we set compilerHost to undefined here and check that instead of flag to see if caching is in effect.
cachingInEffect = false; | |
compilerHost.getSourceFile = originalGetSourceFile; | |
compilerHost.readFile = originalReadFile; | |
compilerHost.fileExists = originalFileExists; | |
compilerHost.directoryExists = originalDirectoryExists; | |
compilerHost.createDirectory = originalCreateDirectory; | |
compilerHost.writeFile = originalWriteFile!; | |
compilerHost = undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, missed this comment. I'm happy to give that a shot, but I found it pretty difficult to track the lifetime of compilerHost
so I'm basically just taking your word for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, though I personally prefer the version without the extra bangs.
@amcasey this seems to have broken the twoslash runner—does this stack trace give you any clue as to how/why? |
@andrewbranch What's twoslash and is that stack from the product code or from a tool? |
...rather than the older, less thorough,
HostCache
. The main benefit is caching file and directory existence (and, especially, non-existence) which cuts mui project load time by 1-2% on my (Linux) box.Alternative to #48942